<template>
	<view>
		<view class="item f-c-c f30">
			<view>{{title}}</view>
			<input class="inputBpx" @input="input1" :placeholder="placeholderText1" />
		</view>

		<view class="item f-c-c f30">
			<view>姓名</view>
			<input class="inputBpx" @input="input2" :placeholder="placeholderText2" />
		</view>
		
		<view class="btn">
			<button @click="toBack" class="themeBac cwhite">确认</button>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				title: "",
				placeholderText1: "",
				placeholderText2: "",
				account:"",
				name:""
			}
		},
		onLoad(e) {
			console.log(e);
			this.title = e.type == 0 ? '微信' : '支付宝'
			this.placeholderText1 = "请输入" + this.title + "账号"
			this.placeholderText2 = "请输入" + this.title + "实名"
		},
		methods: {
			toBack(){
				/* 认证绑定 */
				// this.$back(1)
				this.title=='支付宝'?this.bindingAlipay():this.bindingWechat()
			},
			input1(v){
				this.account=v.detail.value
			},
			input2(v){
				this.name=v.detail.value
			},
			async bindingAlipay(){
				const res=await this.$u.api.bindingAlipay({
					id:this.vuex_user.id,
					name:this.name,
					number:this.account
				})
				console.log(res);
				res.success?this.$back(1):this.$u.toast(res.msg)
			},
			async bindingWechat(){
				const res=await this.$u.api.bindingWechat({
					id:this.vuex_user.id,
					name:this.name,
					number:this.account
				})
				console.log(res);
				res.success?this.$back(1):this.$u.toast(res.msg)
			},
		}
	}
</script>

<style>
	.item {
		margin: 40rpx 60rpx;
		font-weight: 700;
	}
	
	.item view{
		width: 140rpx;
		white-space: nowrap;
	}

	.inputBpx {
		width: 100%;
		background-color: #B9B9B9;
		padding: 10rpx;
		border-radius: 5rpx;
		padding-left: 20rpx;
		margin:0 20rpx;
	}
	.input-placeholder{
		color: #EEEEEE;
		font-size: 30rpx;
		font-weight: 400;
	}
	.btn{
		margin: 100rpx 70rpx;
	}
</style>
